package cn.lg.soar.system.feign;

import cn.lg.soar.core.annotations.ApiClient;
import cn.lg.soar.system.api.constant.ModuleConst;
import cn.lg.soar.system.api.model.RefreshTokenDTO;
import cn.lg.soar.system.api.service.IRefreshTokenApi;
import eu.bitwalker.useragentutils.DeviceType;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author luguoxiang
 * @date 2022/1/2
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@ConditionalOnMissingClass("cn.lg.soar.system.auth.client.RefreshTokenApiClient")
@ApiClient
@FeignClient(
        name= ModuleConst.MODULE_NAME,
        path= ModuleConst.CLIENT_PATH + "/refreshToken",
        contextId="RefreshTokenApiFeign"
)
public interface RefreshTokenApiFeign extends IRefreshTokenApi {


    @GetMapping("getById")
    @Override
    RefreshTokenDTO getById(@RequestParam("id") String id);

    @GetMapping("verify")
    @Override
    RefreshTokenDTO verify(@RequestParam("refreshToken") String refreshToken);

    @GetMapping("idsByUserId")
    @Override
    List<String> idsByUserId(@RequestParam("userIds") List<Long> userIds, @RequestParam("deviceType") DeviceType deviceType);

    @GetMapping("idsByUserIdAndActive")
    @Override
    List<String> idsByUserIdAndActive(@RequestParam("userIds") List<Long> userIds, @RequestParam("deviceType") DeviceType deviceType);
}
